package com.easy.modules.sysmgr.web.action;

import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.easy.common.util.Const;
import com.easy.common.web.BaseController;
import com.easy.common.web.page.DataGrid;
import com.easy.common.web.page.Msg;
import com.easy.modules.sysmgr.service.MenuServiceI;
import com.easy.modules.sysmgr.web.form.MenuForm;

@Controller
@RequestMapping("/sysmgr/menu")
public class MenuAction extends BaseController {
	
	@Autowired
	private MenuServiceI menuService ;
	
	@RequestMapping("/menu_main.do")
	public String menu_main() {
		return Const.SYSMGR + "menu_main" ;
	}
	
	@RequestMapping("/menu_form.do")
	public String menu_form(MenuForm form, Model mode) {
		if(null != form.getId() && !"".equals(form.getId())) {
			mode.addAttribute("id", form.getId()) ;
		}
		return Const.SYSMGR + "menu_form" ;
	}
	
	@RequestMapping("/doNotNeedAuth_get.do")
	@ResponseBody
	public MenuForm doNotNeedAuth_get(MenuForm form) {
		return this.menuService.get(form) ;
	}
	
	@RequestMapping("/add.do")
	@ResponseBody
	public Msg add(MenuForm form, HttpServletRequest request) {
		return this.menuService.add(form) ; 
	}
	
	@RequestMapping("/delete.do")
	@ResponseBody
	public Msg delete(MenuForm form, HttpServletRequest request) {
		Msg j = this.menuService.delete(form) ;
		return j ; 
	}
	
	@RequestMapping("/edit.do")
	@ResponseBody
	public Msg edit(MenuForm form) {
		return this.menuService.edit(form) ; 
	}
	
	@RequestMapping("/datagrid.do")
	@ResponseBody
	public DataGrid datagrid(MenuForm form) {
		return this.menuService.datagrid(form) ; 
	}
	
	@RequestMapping("/treegrid.do")
	@ResponseBody
	public List<MenuForm> treegrid(MenuForm form) {
		return this.menuService.treegrid(form) ;
	}
	
	@RequestMapping("/doNotNeedAuth_treegrid.do")
	@ResponseBody
	public List<MenuForm> doNotNeedAuth_treegrid(MenuForm form) {
		return this.menuService.treegrid(form) ;
	}
	
	@RequestMapping("/doNotNeedAuth_tree.do")
	@ResponseBody
	public List<MenuForm> tree(MenuForm form, HttpServletRequest request) {
		return this.menuService.tree(form, request.getServletContext()) ;
	}
	
	@RequestMapping("/doNotNeedAuth_combotree.do")
	@ResponseBody
	public List<MenuForm> combotree(MenuForm form) {
		return this.menuService.combotree(form) ;
	}
	
	@RequestMapping("/doNotNeedAuth_sort.do")
	@ResponseBody
	public Msg sort(MenuForm form) {
		return this.menuService.sort(form) ;
	}
	
	@RequestMapping("/isShow_hide.do")
	@ResponseBody
	public Msg isShow_hide(MenuForm form) {
		return this.menuService.isShow(form) ;
	}
	
	

}
